home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / manual-p / man_db-2.000 / man_db-2 / man_db-2.3.10 / configure.in < prev    next >
Encoding:
Text File  |  1995-07-13  |  10.2 KB  |  390 lines

  1. dnl Process this file with autoconf v1.116+ to produce a configure script.
  2. dnl
  3. dnl Initialise and check we're in the correct directory.
  4. dnl
  5. AC_INIT(acconfig.h)
  6. AC_CONFIG_AUX_DIR(tools)
  7. AC_CONFIG_HEADER(include/config.h)
  8. AC_ARG_PROGRAM
  9. dnl
  10. dnl Define below date and version information to be put into man pages etc.
  11. dnl
  12. date="July 12th, 1995"
  13. version="2.3.10" 
  14. dnl
  15. dnl MAN_ECHO("string to be echoed")dnl
  16. define(MAN_ECHO, [echo $1 1>&AC_FD_MSG])dnl
  17. dnl MAN_ECHO_VAR(ENV-VARIABLE)
  18. define(MAN_ECHO_VAR, [MAN_ECHO("default $1 = \"$$1\"")])dnl
  19. dnl
  20. dnl Use some un-documented features to find unique autoconf version integer
  21. dnl
  22. define(MAN_AC_VERSION, [builtin(eval, $3 + $2 * 1000 + $1 * 1000000)])dnl
  23. man_ac_version=MAN_AC_VERSION(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)))
  24. dnl
  25. AC_SUBST(date)dnl
  26. AC_SUBST(version)dnl
  27. AC_SUBST(man_ac_version)dnl
  28. dnl
  29. dnl We have to be a bit naughty here and supply options.
  30. dnl The autoconf literature states that only features that can be 
  31. dnl separately 'built' should use --enable and friends. Oh well...
  32. dnl Current options: debug, setuid, device, db.
  33. dnl 
  34. AC_ARG_ENABLE(debug,
  35. [  --enable-debug      build a Makefile suitable for debugging purposes], 
  36.      [: ${LDFLAGS=-g}
  37.       MAN_ECHO("Enabling debugging Makefile")
  38.       debug=on], 
  39.      [: ${CFLAGS=-O} 
  40.       : ${LDFLAGS=-s}
  41.       AC_DEFINE(NDEBUG)
  42.       debug=off])
  43. AC_ARG_ENABLE(setuid,
  44. [  --enable-setuid[=ARG]      install man setuid to user ARG (default - ARG=man)
  45.   --disable-setuid      don't install man setuid],
  46.       [if test "$enableval" = "yes" 
  47.        then
  48.         enableval=man
  49.        fi
  50.        if test "$enableval" = "no" 
  51.        then
  52.         man_owner=
  53.         man_install_flags="-m 755"
  54.         MAN_ECHO("Man will not be installed setuid")
  55.        else
  56.         man_owner=$enableval
  57.         man_install_flags="-m 4755 -o $man_owner"
  58.         MAN_ECHO("Man will be installed setuid $enableval")
  59.            AC_DEFINE_UNQUOTED(SECURE_MAN_UID, "$man_owner")
  60.        fi],
  61.       [man_owner=man
  62.        man_install_flags="-m 4755 -o man"
  63.        AC_DEFINE_UNQUOTED(SECURE_MAN_UID, "$man_owner")])
  64. AC_ARG_WITH(device,
  65. [  --with-device=DEVICE      use nroff with the output device DEVICE],
  66.     [if test "$withval" = "yes" || test "$withval" = "no" 
  67.      then
  68.          AC_MSG_ERROR(--with-device requires an argument)
  69.      else
  70.          nroff_device=" -T$withval"
  71.      fi])
  72. AC_ARG_WITH(db,
  73. [  --with-db=LIBRARY      use database library LIBRARY (db, gdbm, ndbm)],
  74.     [if test "$withval" = "yes" || test "$withval" = "no" 
  75.      then
  76.          AC_MSG_ERROR(--with-db requires an argument)
  77.      else
  78.          db=$withval
  79.      fi],
  80.      : ${db=no})
  81. dnl
  82. dnl Finish the argument parsing
  83. dnl
  84. AC_SUBST(man_install_flags)dnl
  85. AC_SUBST(debug)dnl
  86. dnl
  87. dnl Check $PATH for the following progs and append suitable options.
  88. dnl 
  89. AC_PROG_CC
  90. AC_PROG_CPP
  91. AC_PROG_INSTALL
  92. AC_PROG_RANLIB
  93. AC_PATH_PROG(cat, cat)
  94. AC_PATH_PROG(tr, tr)
  95. AC_CHECK_PROGS(pager, less more)
  96. test "$pager" && pager="$pager -s"
  97. dnl
  98. dnl define below (in list of preference) *roff macros to check for.
  99. dnl
  100. macros="andoc an doc"
  101. dnl
  102. dnl We have problems here, as different systems have different *roff
  103. dnl formatters and they accept different options and do different things :(
  104. dnl
  105. AC_PATH_PROGS(nroff, nroff gnroff groff)
  106. if test "$nroff"
  107. then
  108.     dnl define GNU_NROFF if necessary
  109.     MAN_PROG_GNU_NROFF($nroff)
  110.     if test "$nroff_device" 
  111.     then
  112.         AC_MSG_CHECKING(that nroff works with argument$nroff_device)
  113. dnl
  114. dnl  cannot cache this result as it can change between runs of configure.
  115. dnl
  116.         if $nroff $nroff_device /dev/null >/dev/null 2>&1 3>&1
  117.         then 
  118.             AC_MSG_RESULT(yes)
  119.         else
  120.             AC_MSG_RESULT(no)
  121.             AC_MSG_ERROR(nroff does not work with argument$nroff_device)
  122.         fi
  123.     fi
  124.     AC_MSG_CHECKING(for appropriate nroff macro)
  125.     AC_CACHE_VAL(man_cv_prog_nroff_macro, [
  126.     
  127.     for macro in $macros
  128.     do
  129.         if $nroff -m$macro $nroff_device /dev/null >/dev/null 2>&1 3>&1
  130.         then
  131.             man_cv_prog_nroff_macro=-m$macro
  132.             break
  133.         fi
  134.     done])
  135.     
  136.     if test "$man_cv_prog_nroff_macro"
  137.     then
  138.         nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
  139.         AC_MSG_RESULT($man_cv_prog_nroff_macro)
  140.     else
  141.         AC_MSG_RESULT(ambiguous)
  142.         AC_MSG_WARN(please edit include/manconfig.h and add nroff definition)
  143.     fi 
  144. else
  145.     AC_MSG_WARN(Cannot find an nroff-like program, formatting of manual page source will not be supported.)
  146.     nroff="(nroff not installed)"
  147.     AC_DEFINE(NROFF_MISSING)
  148. fi
  149. AC_PATH_PROGS(troff, groff)
  150. if test "$troff"
  151. then
  152.     AC_DEFINE(TROFF_IS_GROFF)
  153.     TROFF=groff
  154. else
  155.     AC_PATH_PROGS(troff, troff gtroff)
  156.     TROFF=troff
  157. fi
  158. if test "$troff"
  159. then
  160.     AC_DEFINE(HAS_TROFF)
  161.     AC_MSG_CHECKING(for appropriate $TROFF options)
  162.     AC_CACHE_VAL(man_cv_prog_troff_options, [
  163. dnl    
  164. dnl do a quick test to see if -t works [AIX needs this], groff doesn't as
  165. dnl it indicates pre-process with tbl.
  166. dnl
  167.     test "$TROFF" = "troff" && $troff -t /dev/null >/dev/null 2>&1 3>&1 \
  168.                 && troff_filter="-t "
  169.     for macro in $macros
  170.     do
  171.         if $troff $troff_filter -m$macro /dev/null >/dev/null 2>&1 3>&1
  172.         then
  173.             man_cv_prog_troff_options="${troff_filter}-m${macro}"
  174.             break
  175.         fi
  176.     done])
  177.     if test "$man_cv_prog_troff_options"
  178.     then
  179.         troff="$troff $man_cv_prog_troff_options"
  180.         AC_MSG_RESULT($man_cv_prog_troff_options)
  181.     else
  182.         AC_MSG_RESULT(ambiguous)
  183.         AC_MSG_WARN(please edit include/manconfig.h and add troff definition)
  184.     fi
  185. else
  186.     troff="(troff not installed)"
  187. fi
  188. dnl 
  189. AC_PATH_PROGS(eqn, eqn geqn)
  190. AC_PATH_PROGS(neqn, neqn gneqn)
  191. dnl
  192. dnl if we fail to find an neqn, use eqn and try to force it to output
  193. dnl for an ascii device. As this is only relevant for equations (?), not
  194. dnl using latin1 should be acceptable. -Tlatin1 is ignored by some eqn.
  195. dnl
  196. if test -z "$neqn"
  197. then
  198.     test "$eqn" && 
  199.     (test "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
  200. fi
  201. AC_PATH_PROGS(tbl, tbl gtbl)
  202. AC_PATH_PROGS(col, col gcol)
  203. AC_PATH_PROGS(vgrind, vgrind gvgrind)
  204. AC_PATH_PROGS(refer, refer grefer)
  205. AC_PATH_PROGS(grap, grap)
  206. AC_PATH_PROGS(pic, pic gpic)
  207. AC_PATH_PROG(gzip, gzip)
  208. if test "$gzip"
  209. then
  210.     gunzip="$gzip -dc"
  211.     compressor="$gzip -c7"
  212.     compress_ext="gz"
  213.     decompressor="$gunzip"
  214. fi
  215. AC_PATH_PROG(compress, compress)
  216. if test "$compress"
  217. then
  218.     uncompress="$compress -dc"
  219.     if test -z "$gzip"
  220.     then
  221.         compressor="$compress -c"
  222.         compress_ext="Z"
  223.         decompressor="$uncompress"
  224.     fi
  225. fi
  226. if test "$gzip" || test "$compress"
  227. then
  228.     AC_DEFINE(COMP_CAT)
  229.     AC_DEFINE(COMP_SRC)
  230. fi
  231. AC_SUBST(compressor)dnl
  232. AC_SUBST(compress_ext)dnl
  233. AC_SUBST(gunzip)dnl
  234. AC_SUBST(uncompress)dnl
  235. AC_SUBST(decompressor)dnl
  236. dnl
  237. dnl to add more decompressors just follow the scheme above.
  238. dnl 
  239. dnl check for various header files and associated libraries.
  240. dnl
  241. AC_AIX
  242. AC_MINIX
  243. AC_ISC_POSIX
  244. dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
  245. AC_PROG_LEX
  246. AC_STDC_HEADERS
  247. AC_HEADER_SYS_WAIT
  248. AC_HEADER_DIRENT
  249. AC_CHECK_HEADERS(unistd.h memory.h fcntl.h limits.h sys/file.h regex.h)
  250. AC_CHECK_HEADERS(string.h strings.h, break)
  251. dnl
  252. dnl Checks for structures and compiler characteristics.
  253. dnl
  254. AC_C_CONST
  255. AC_C_INLINE
  256. AC_TYPE_OFF_T
  257. AC_TYPE_PID_T
  258. AC_TYPE_UID_T
  259. AC_TYPE_SIZE_T
  260. dnl
  261. dnl Checks for functions.
  262. dnl
  263. AC_FUNC_ALLOCA
  264. AC_FUNC_MEMCMP
  265. AC_TYPE_SIGNAL
  266. AC_FUNC_STRCOLL
  267. AC_FUNC_VFORK
  268. AC_FUNC_VPRINTF
  269. MAN_FUNC_ANSI_SPRINTF
  270. MAN_FUNC_PCLOSE
  271. dnl
  272. dnl Find a suitable database interface header and library
  273. dnl
  274. dnl Check for Berkeley db routines
  275. dnl
  276. if test "$db" = "no" || test "$db" = "db"
  277. then
  278.   AC_CHECK_HEADER(db.h,[
  279.     for lib in db c
  280.     do
  281.       AC_CHECK_LIB($lib, dbopen, test "$lib" = "c" || LIBS="$LIBS -l$lib" 
  282.                      AC_DEFINE(BTREE)
  283.                      db=yes, db=no)
  284.       test "$db" = "yes" && break
  285.     done], db=no)
  286. fi
  287. dnl
  288. dnl Check for GNU dbm routines
  289. dnl
  290. if test "$db" = "no" || test "$db" = "gdbm"
  291. then
  292.   AC_CHECK_HEADER(gdbm.h,[
  293.     for lib in gdbm c dbm
  294.     do
  295.       AC_CHECK_LIB($lib, gdbm_fetch, test "$lib" = "c" || LIBS="$LIBS -l$lib" 
  296.                                      AC_DEFINE(GDBM)
  297.                                      db=yes, db=no)
  298.       if test "$db" = "yes" 
  299.       then
  300. dnl Need to explicitly check for some routines, rather than using 
  301. dnl version info extracted from gdbm.h
  302.         AC_CHECK_FUNCS(gdbm_exists gdbm_setopt)
  303.         break
  304.       fi
  305.     done], db=no)
  306. fi
  307. dnl
  308. dnl Check for UNIX ndbm routines
  309. dnl
  310. if test "$db" = "no" || test "$db" = "ndbm"
  311. then
  312.   AC_CHECK_HEADER(ndbm.h,[
  313.     for lib in ndbm c dbm
  314.     do
  315.       AC_CHECK_LIB($lib, dbm_fetch, test "$lib" = "c" || LIBS="$LIBS -l$lib"
  316.                           AC_DEFINE(NDBM)
  317.                     db=yes, db=no)
  318.       test "$db" = "yes" && break
  319.       done], db=no)
  320. fi 
  321. if test "$db" != "yes"
  322. then 
  323.     if test "$db" = "no"
  324.     then
  325.       AC_MSG_ERROR(Fatal: no supported database library/header found)
  326.     else
  327.       AC_MSG_ERROR(Fatal: $db: unsupported database library)
  328.     fi
  329. fi
  330. if test "$debug" = "on" 
  331. then
  332.   AC_CHECK_LIB(efence, EF_Print)
  333. fi
  334. dnl
  335. dnl Check for available functions.
  336. dnl
  337. AC_CHECK_FUNCS(getcwd getwd, break)
  338. AC_CHECK_FUNCS(atexit on_exit, break)
  339. AC_CHECK_FUNCS(setreuid strerror)
  340. AC_CHECK_FUNC(setlocale,
  341.   AC_DEFINE(HAVE_SETLOCALE)
  342.   AC_CHECK_FUNC(catopen,
  343.     nls=on,
  344.     AC_CHECK_LIB(i, catopen,
  345.       LIBS="$LIBS -li"
  346.       nls=on,
  347.       nls=off)),
  348.   nls=off)
  349. AC_SUBST(nls)dnl
  350. dnl
  351. dnl I think it's reasonable to assume that the system has the following 
  352. dnl headers if the (POSIXy) functions exist.
  353. dnl 
  354. AC_CHECK_FUNC(regcomp, AC_DEFINE(POSIX_REGEX),
  355.   AC_CHECK_FUNC(re_comp, AC_DEFINE(BSD_REGEX), 
  356.     AC_MSG_WARN(no regex routines found, whatis/apropos will ignore -r)))
  357. AC_CHECK_FUNC(fnmatch, AC_DEFINE(HAVE_FNMATCH_H), LIBOBJS="$LIBOBJS fnmatch.o")
  358. AC_CHECK_FUNC(globfree, AC_DEFINE(HAVE_GLOB_H), LIBOBJS="$LIBOBJS glob.o")
  359. AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_H), LIBOBJS="$LIBOBJS getopt.o getopt1.o")
  360. AC_REPLACE_FUNCS(flock putenv realpath rename basename tempnam waitpid strstr strsep strcspn strspn)
  361. dnl
  362. MAN_ECHO_VAR(CC)
  363. MAN_ECHO_VAR(CPP)
  364. MAN_ECHO_VAR(CPPFLAGS)
  365. MAN_ECHO_VAR(CFLAGS)
  366. MAN_ECHO_VAR(LDFLAGS)
  367. AC_OUTPUT(GNUmakefile \
  368.       lib/Makefile \
  369.       src/Makefile \
  370.       nls/Makefile \
  371.       man/Makefile \
  372.       xcat/Makefile \
  373.       libdb/Makefile \
  374.       gencat/Makefile \
  375.       zsoelim/Makefile \
  376.       include/Defines \
  377.       include/comp_src.h \
  378.       include/manconfig.h) 
  379. date > stamp-h
  380. dnl Create a bogus makefile that non-GNU make's will try to use. This is 
  381. dnl better than messages like `make:105: missing separator **' 
  382. cat > makefile <<MEOF
  383. all:
  384.     @echo "Compilation of this package requires GNU make ver 3.68 or above."
  385.     @echo "If you are using GNU make and it ignores the GNUmakefile in this"
  386.     @echo "directory, issue the command 'make -f GNUmakefile'"
  387.  
  388. update install clean realclean distclean TAGS dist: all
  389. MEOF
  390.